package demo;

import java.io.IOException;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.joda.time.DateTime;
import org.joda.time.Seconds;

public class ConnectThread extends Thread {

	@Override
	public void run() {
		
		CloseableHttpClient httpclient = HttpClients.createDefault();
		//check path
		HttpGet httpget = new HttpGet("http://127.0.0.1:8080/test");
		CloseableHttpResponse response = null;
		try {
			response = httpclient.execute(httpget);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	
	public static void main(String[] args) throws IOException {
		DateTime start = DateTime.now();
		System.out.println("starttime:" + DateTimeUtil.format2Y4_M_dTHms$S3(start));
		for(int i = 0; i < 20; i++){
			new ProducerGroup().start();
		}
		DateTime end = DateTime.now();
		System.out.println("endtime:" + DateTimeUtil.format2Y4_M_dTHms$S3(end));
		System.out.println("use time:" + Seconds.secondsBetween(start, end) +" s");
		System.in.read();
	}
}
